package com.gui.juc.base.thread.method;

import com.gui.utils.Sleeper;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j
public class SleepDemo {

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.debug("start running...");
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                log.error("interrupted...");
            }
            log.debug("go on...");
        }, "t1");

        t1.start();
        Sleeper.sleep(TimeUnit.SECONDS, 1);
        log.debug("interrupt!!!!");
        t1.interrupt();
    }

}
